package behavior.memento;

public class Test {
    public static void main(String[] args) {

        //捕获者
        CareTaker careTaker = new CareTaker();

        //游戏角色 初始化满血
        GameRole gameRole = new GameRole(100,100);

        careTaker.setMemento(gameRole.createMemento());

        //中途血量减少
        gameRole.setNewValue(50,30);
        System.out.println(gameRole);

        //满血恢复
        gameRole.recover(careTaker.getMemento());
        System.out.println(gameRole);

    }
}
